/**
 * 游戏配置文件
 * @class GameConfig
 */
export class GameConfig {
    /** 当前关卡 */
    public static CURRENT_LEVEL: number = 1;
    
    /** 总关卡数 */
    public static TOTAL_LEVELS: number = 8;
    
    /** 每关的配置设置 */
    public static LEVEL_SETTINGS = [
        {
            id: 1,
            level: 1,
            name: "第一关",
            difficulty: "简单",
            score: 100,
            food1: 1,
            food2: 1,
            answers: [1, 2, 3, 4],
            rightAnswer: 2,
        },
        {
            id: 2,
            level: 2,
            name: "第二关",
            difficulty: "简单",
            score: 200,
            food1: 1,
            food2: 2,
            answers: [3, 2, 4, 5],
            rightAnswer: 3,
        },
        {
            id: 3,
            level: 3,
            name: "第三关",
            difficulty: "简单",
            score: 300,
            food1: 2,
            food2: 3,
            answers: [3, 2, 4, 5],
            rightAnswer: 5,
        },
        {
            id: 4,
            level: 4,
            name: "第四关",
            difficulty: "简单",
            score: 400,
            food1: 1,
            food2: 4,
            answers: [6, 5, 3, 4],
            rightAnswer: 5,
        },
        {
            id: 5,
            level: 5,
            name: "第五关",
            difficulty: "普通",
            score: 500,
            food1: 2,
            food2: 2,
            answers: [5, 2, 8, 1],
            rightAnswer: 4,
        },
        {
            id: 6,
            level: 6,
            name: "第六关",
            difficulty: "普通",
            score: 600,
            food1: 3,
            food2: 1,
            answers: [9, 4, 5, 2],
            rightAnswer: 4,
        },
        {
            id: 7,
            level: 7,
            name: "第七关",
            difficulty: "普通",
            score: 700,
            food1: 2,
            food2: 5,
            answers: [3, 7, 5, 6],
            rightAnswer: 7,
        },
        {
            id: 8,
            level: 8,
            name: "第八关",
            difficulty: "困难",
            score: 800,
            food1: 4,
            food2: 3,
            answers: [5, 7, 3, 8],
            rightAnswer: 7,
        },
        {
            id: 9,
            level: 9,
            name: "第九关",
            difficulty: "困难",
            score: 900,
            food1: 3,
            food2: 6,
            answers: [6, 9, 3, 4],
            rightAnswer: 9,
        },
        {
            id: 10,
            level: 10,
            name: "第十关",
            difficulty: "地狱",
            score: 1000,
            food1: 5,
            food2: 5,
            answers: [2, 4, 3, 10],
            rightAnswer: 10,
        },
    ];

    /**
     * 获取指定关卡的设置
     * @param level 关卡编号
     * @returns 关卡设置对象
     */
    public static getLevelSetting(level: number) {
        if (level < 1 || level > this.LEVEL_SETTINGS.length) {
            console.error(`关卡 ${level} 不存在`);
            return null;
        }
        return this.LEVEL_SETTINGS[level - 1];
    }
    
    /**
     * 设置当前关卡
     * @param level 关卡编号
     */
    public static setCurrentLevel(level: number) {
        if (level < 1 || level > this.TOTAL_LEVELS) {
            console.error(`关卡 ${level} 超出范围`);
            return;
        }
        this.CURRENT_LEVEL = level;
    }
    
    /**
     * 获取下一关卡
     * @returns 下一关卡编号
     */
    public static getNextLevel() {
        return Math.min(this.CURRENT_LEVEL + 1, this.TOTAL_LEVELS);
    }
} 